package com.plian.system.wrapper.im;

import com.plian.system.dto.im.FundProjectExecutionDTO;
import com.plian.system.entity.im.FundProjectExecution;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.im.FundProjectExecutionVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: panqb
 * @create: 2022-04-15 14:14
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface FundProjectExecutionWrapper extends BaseWrapper<FundProjectExecution, FundProjectExecutionDTO, FundProjectExecutionVO> {

    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "filingUnitId", target = "filingUnitName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME)
    })
    FundProjectExecutionVO entityToVO(FundProjectExecution entity);

}
